package com.emperor.treatment.app;

import java.util.Map;

import org.apache.log4j.Logger;

import com.emperor.core.app.App;
import com.emperor.core.app.AppConstant;
import com.emperor.core.app.AppCtrl;

public class TreatmentAppCtrl implements AppCtrl {

	public static final String TREATMENT_CTRL = "treatment.ctrl";
	public static final String TREATMENT_NEW = "treatment.new";
	public static final String TREATMENT_MGM = "treatment.mgm";
	public static final String TREATMENT_MOV = "treatment.mov";
	public static final String TREATMENT_ENQ = "treatment.enq";
	public static final String TREATMENT_DEL = "treatment.del";
	public static final String TREATMENT_PRODENQ = "treatment.prodenq";
	public static final String TREATMENT_PRODNEW = "treatment.prodnew";
	public static final String TREATMENT_PRODMGM = "treatment.prodmgm";
	public static final String TREATMENT_PRODDEL = "treatment.proddel";
	
	public static final String TREATMENT_MSG = "treatment.msg";
	public static final String TREATMENT_ID = "treatment.id";
	public static final String PROD_ID = "prod.id";
	public static final String TREATMENTPROD_ID = "treatmentprod.id";
	public static final String TREATMENT_LIST = "treatment.list";
	public static final String TREATMENT_ACTIONNAME = "treatment.actionname";
	
	public static Logger log = Logger.getLogger(TreatmentAppCtrl.class);
	
	@Override
	public void doProcess(Map<String, Object> params) {
			App app = null;
			if (params == null) {
				log.error("Param is null");
			} else if (params.get(AppConstant.ACTION).equals(TREATMENT_MGM)) {
				app = new TreatmentAppMgm(params);
			} else if (params.get(AppConstant.ACTION).equals(TREATMENT_NEW)) {
				app = new TreatmentAppNew(params);
			} else {
				app = new TreatmentAppEnq(params);
			}
			
			if (app != null) {
				app.open();
			}
	}

}
